package myky.com.doctorapp.presenter

import io.reactivex.disposables.Disposable
import myky.com.doctorapp.R
import myky.com.doctorapp.base.BasePresenterIm
import myky.com.doctorapp.base.RxSubscribe
import myky.com.doctorapp.contract.FollowHtmlActivityContract
import myky.com.doctorapp.entity.FollowUploadEntity
import myky.com.doctorapp.model.FollowHtmlActivityModel
import myky.com.doctorapp.utils.ToastUtils

/**
 * Description:
 *
 * @author wuyangwuyang
 * Created by 2019/3/20 on 16:22
 */
class FollowHtmlActivityPresenter :BasePresenterIm<FollowHtmlActivityContract.View>(), FollowHtmlActivityContract.Presenter{


    var followHtmlActivityModel=FollowHtmlActivityModel()
    override fun puploadFollowHtml(data:String) {
        followHtmlActivityModel.uploadFollowHtml(data).subscribe(object:RxSubscribe<FollowUploadEntity.DataBean>(){
            override fun onSuccess(t: FollowUploadEntity.DataBean) {
                mView.hideLoading()
                mView.showContentView()
                mView.showDataSuccess(t)
            }

            override fun onFailed(code: Int, msg: String?) {
                mView.hideLoading()
                ToastUtils.show(mContext.resources.getString(R.string.net_exception))
            }

            override fun onSubscribe(d: Disposable) {
                mView.showLoadingView(mContext.resources.getString(R.string.RemoteSubmit_loading))
                addSubscription(d)
            }


        })
    }


}
